cloog_version=0.18.3
cloog_build_dir=$builds_dir_root/cross-cloog-$cloog_version
cloog_src_dir=$src_dir_root/cloog-$cloog_version

rm -Rf "$cloog_src_dir"
cd "$src_dir_root"
tar zxf "cloog-$cloog_version.tar.gz"

rm -Rf "$cloog_build_dir"
mkdir -p "$cloog_build_dir"
cd "$cloog_build_dir"

export CFLAGS=-O0
"$cloog_src_dir/configure"			\
	"--prefix=$cross_dir_root"		\
	--with-isl=system			\
	"--with-isl-prefix=$cross_dir_root"	\
	"--with-gmp-prefix=$cross_dir_root"	\
	--with-osl=system			\
	"--with-osl-prefix=$cross_dir_root"	\
	--disable-static			\
	--enable-portable-binary		\
	--with-gnu-ld
unset CFLAGS

make

install_tmp_dir=/tmp/cross-cloog-$cloog_version
rm -Rf "$install_tmp_dir"
mkdir -p "$install_tmp_dir"
make install "DESTDIR=$install_tmp_dir"

install_dirs_with_prefix "$builders_dir_root/cross-cloog/runtime.dirs" "$cross_dir_root/"
install_files_with_prefix "$builders_dir_root/cross-cloog/runtime.files" "$install_tmp_dir" "$cross_dir_root/"
install_links_with_prefix "$builders_dir_root/cross-cloog/runtime.links" "$cross_dir_root/"
install_dirs_with_prefix  "$builders_dir_root/cross-cloog/devel.dirs" "$cross_dir_root/"
install_files_with_prefix "$builders_dir_root/cross-cloog/devel.files" "$install_tmp_dir" "$cross_dir_root/"
install_links_with_prefix "$builders_dir_root/cross-cloog/devel.links" "$cross_dir_root/"
elf_strip_with_prefix "$builders_dir_root/cross-cloog/elf_strip" "$cross_dir_root/"

rm -Rf "$install_tmp_dir"
rm -Rf "$cloog_build_dir"
rm -Rf "$cloog_src_dir"
